//
//  MyBigImageViewController.m
//  Day5_图片浏览
//
//  Created by apple on 16/5/17.
//  Copyright © 2016年 ljp. All rights reserved.
//

#import "MyBigImageViewController.h"
#import "MyBigPhotoCollectionView.h"
#import "MyPhotoCollectionViewCell.h"

@interface MyBigImageViewController ()
{
    BOOL isNavigationBarHidden;
    MyBigPhotoCollectionView *myBigPhotoCollectionView;
}
@end

@implementation MyBigImageViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    isNavigationBarHidden = NO;

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hideNavigationBarAction) name:KHideNavigationBar object:nil];

    myBigPhotoCollectionView = [[MyBigPhotoCollectionView alloc] initWithFrame:self.view.bounds];
    [self.view addSubview:myBigPhotoCollectionView];

    myBigPhotoCollectionView.urlArray = _urlArray;
}

- (void)dealloc {

    [[NSNotificationCenter defaultCenter]removeObserver:self];
}
- (void)hideNavigationBarAction {

    isNavigationBarHidden = !isNavigationBarHidden;

    [self.navigationController setNavigationBarHidden:isNavigationBarHidden animated:YES];
}

- (void)viewWillAppear:(BOOL)animated {

    [myBigPhotoCollectionView scrollToItemAtIndexPath:_indexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:NO];
}

@end
